from django.db import models


# Create your models here.

# class BaseTime(models.Model):
#     create_time = models.DateTimeField(auto_now_add=True)
#     update_time = models.DateTimeField(auto_now=True)
#
#     class Meta:
#         abstract = True
#
#
# class User(BaseTime):
#     username = models.CharField(max_length=100)
#     password = models.CharField(max_length=255)
#     num = models.CharField(max_length=11)
#
#     class Meta:
#         db_table = 'users'
#
#
# class Area(BaseTime):
#     name = models.CharField(max_length=100)
#     fid = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True)
#
#     class Meta:
#         db_table = 'area'
#
#
# class Address(BaseTime):
#     user = models.ForeignKey(User, on_delete=models.CASCADE)
#     name = models.CharField(max_length=50, verbose_name='收货人')
#     ressname = models.CharField(max_length=100, verbose_name='地址')
#     num = models.CharField(max_length=11, verbose_name='手机号')
#     gnum = models.CharField(max_length=20, verbose_name='固定电话')
#     emall = models.EmailField(verbose_name='邮箱')
#     delete = models.BooleanField(verbose_name='是否删除')
#     moren = models.BooleanField(verbose_name='是否默认')
#
#     class Meta:
#         db_table = 'address'
#
#
# class Cate(BaseTime):
#     name = models.CharField(max_length=50, verbose_name='分类名称')
#     pic = models.ImageField(verbose_name='分类图片')
#     types = models.IntegerField(verbose_name='分类等级')
#     fid = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True)
#
#     class Meta:
#         db_table = 'cate'
#
#
# class Shop(BaseTime):
#     name = models.CharField(max_length=20, verbose_name='商品名称')
#     price = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='商品名称')
#     stock = models.IntegerField(verbose_name='商品库存')
#     pic = models.ImageField(verbose_name='商品图片')
#     comnum = models.IntegerField(verbose_name='评论总数')
#     cate = models.ForeignKey(Cate, on_delete=models.CASCADE, verbose_name='分类ID')
#     jieshao = models.CharField(max_length=50, verbose_name='商品介绍')

# 新闻表
class News(models.Model):
    title = models.CharField(max_length=50, verbose_name='标题')
    content = models.TextField(verbose_name='内容')

    class Meta:
        db_table = 'news'


# 广告表
class Advertisement(models.Model):
    pic = models.ImageField(verbose_name='图片')
    url = models.CharField(max_length=100, verbose_name='跳转地址')
    types = models.CharField(max_length=50, verbose_name='类型')

    class Meta:
        db_table = 'xinwen'
